package com.ibm.test.consumer.rest;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ibm.iisp.base.model.IDictItem;
import com.ibm.iisp.base.service.BaseService;
import com.ibm.iisp.common.exception.I18nAppException;

@RestController
public class ConsumerController {

	@Autowired
	BaseService baseService;

	@RequestMapping("/hello/{name}")
	public List<IDictItem> index(@PathVariable("name") String name) {
		return (List<IDictItem>) baseService.getDictItemsByGroup(name, null);
	}

	@RequestMapping("/mail/test")
	public void save() throws I18nAppException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("dataDate", new Date());

		baseService.sendMail("from", "to", 123L, params);
	}


}